From: Colin Walters Date: Fri, 22 Jul 2016 20:58:26 +0000 (-0400) Subject: pull: Don't execute static deltas when mirroring X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~49^2~62 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=bac1fa18390da157e8b9aa9014b4e901af8d7fce;p=ostree.git pull: Don't execute static deltas when mirroring We don't presently support this, since the static delta code assumes it can just `mmap()` file objects. We could at some point implement this, but for now just skip executing deltas when doing `archive -> archive` mirroring. I noticed this when trying to mirror a repo in Jenkins in [CAHC](https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel). Closes: #408 Approved by: giuseppe --- diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 82bf66f6..0d342d3f 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -2705,7 +2705,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, &from_revision, error)) goto out; - if (!disable_static_deltas && (from_revision == NULL || g_strcmp0 (from_revision, to_revision) != 0)) + if (!disable_static_deltas && !pull_data->is_mirror && + (from_revision == NULL || g_strcmp0 (from_revision, to_revision) != 0)) { if (!request_static_delta_superblock_sync (pull_data, from_revision, to_revision, &delta_superblock, cancellable, error)) diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 8e8a6934..b050e111 100755 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -35,7 +35,7 @@ function verify_initial_contents() { assert_file_has_content baz/cow '^moo$' } -echo "1..11" +echo "1..12" # Try both syntaxes repo_init @@ -57,6 +57,17 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo fsck $OSTREE show main >/dev/null echo "ok pull mirror" +cd ${test_tmpdir} +rm checkout-origin-main -rf +$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main +echo moomoo > checkout-origin-main/baz/cow +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "" --tree=dir=checkout-origin-main +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo fsck +${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main +${CMD_PREFIX} ostree --repo=mirrorrepo fsck +echo "ok pull mirror (should not apply deltas)" + cd ${test_tmpdir} mkdir mirrorrepo-local ${CMD_PREFIX} ostree --repo=mirrorrepo-local init --mode=archive-z2